#!/usr/bin/sh
# Copyright (c) 2011 GhostBSD
#
# See COPYING for licence terms.
#
# gbi.sh v 0.0 Tuesday, February 22 2011 10:54:53 Eric
#
title="EXIT: What do you want to do ?"
exit_type=`zenity  --width="530" --height="220" --title="$title" --list --radiolist --column="Click Here" \
    --column="Exit Type" --column="Description" \
    TRUE "Reboot" "Reboot the PC"\
    FALSE "Shutdown" "Shutdown the PC"\
    FALSE "Cancel" "To contine on the liveCD" \
    | sed 's/ max//g' `

echo "$exit_type chosen as the Exit Type!."

#user must select a target type (Check if they cancelled)
if [ ! "$exit_type" ]; then
    zenity --error --title="Error" --text="You must make a selection!"
    exit
fi

######### This part takes the selection and applies it!  #############

# Edit this first section if not using openbox! #

if [ "$exit_type" = "Reboot" ]
then
        # Do Reboot here.
        sudo shutdown -r now | zenity --progress --percentage=95 --title=Reboot --auto-close --auto-kill --no-cancel --width=300

elif [ "$exit_type" = "Shutdown" ]
then
        # Do Shutdown here.
    sudo shutdown -p now | zenity --progress --percentage=95 --title=Shutdown --auto-close --auto-kill --no-cancel --width=300



